// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import Qt 4.7

Item {
    width: pro_width
    height: pro_height

    property int pro_width: 200
    property int pro_height: 80
    property string textstring: ""
    property int text_size: 44
    property string main_color: "white"
    property string press_color: "black"
    property bool isEnable: true

    signal buttonclick()

    Rectangle {
        id: button_main
        color: "#aaaaaa"
        radius: 0
        border.width: 2
        border.color: "#002aff"
        opacity: 0.600
        smooth: false
        anchors.rightMargin: 5
        anchors.leftMargin: 5
        anchors.bottomMargin: 5
        anchors.topMargin: 5
        anchors.fill: parent
    }

    MouseArea {
        id: mouse_area1
        hoverEnabled: true
        anchors.fill: parent
        enabled: isEnable

        //        onPressed:
        //        {
        //            button_main.color = "white";
        ////            button_main.border.color = "white";
        //            buttontext.color = "black";
        //        }

        //        onReleased:
        //        {
        //            button_main.color = "#00000000";
        ////            button_main.border.color = "black";
        //            buttontext.color = "white";
        //        }

//        onContainsMouseChanged:
//        {
//        }

        onClicked:
        {
            buttonclick();
        }
    }

    Text {
        id: buttontext
        x: 100
        y: 14
        color: "#ffffff"
        text: textstring
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
        width: button_main.width - 10
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
        font.pixelSize: text_size
        elide: Text.ElideRight
    }


    states: [
        State {
            name: "over"
            when: mouse_area1.containsMouse

            PropertyChanges {
                target: button_main
                color: "#cacaca"
                opacity: 0.900
            }
        },
        State {
            name: "pressed"
            when: mouse_area1.pressed

            PropertyChanges {
                target: button_main
                color: "#4d4d4d"
                opacity: 0.400
            }
        }
    ]

}
